<?php if(!defined('PUBLIC_DIR')) die('No Access!');

class DefaultInstaller extends InstallerBase implements iInstaller{
	private $Database = array();
	private $Routers = array(
		'/' => 'Default_Index',
	);
	private $Events = array(
		'Default_Index' => array('DefaultController::Index'),
	);
	private $Styles = array();
	private $Scripts = array();
	
	public function Install(){
		foreach($this->Database as $Name => $Table){
			$this->CreateTable($Name, $Table);
		}
		foreach($this->Routers as $Pattern => $Router){
			$this->AddRouter($Pattern, $Router);
		}
		foreach($this->Events as $Name => $Event){
			$this->AddEvent($Name, $Event);
		}
		foreach($this->Styles as $Style){
			$this->AddStyle($Style);
		}
		foreach($this->Scripts as $Script){
			$this->AddScript($Script);
		}
	}

	public function Uninstall(){
		foreach($this->Database as $Name => $Table){
			$this->DropTable($Name, $Table);
		}
		foreach($this->Routers as $Pattern => $Router){
			$this->RemRouter($Pattern, $Router);
		}
		foreach($this->Events as $Name => $Event){
			$this->RemEvent($Name, $Event);
		}
		foreach($this->Styles as $Style){
			$this->RemStyle($Style);
		}
		foreach($this->Scripts as $Script){
			$this->RemScript($Script);
		}
	}

	public function Reinstall(){
		$this->Uninstall();
		$this->Install();
	}
}